package flyway;

import org.flywaydb.core.Flyway;

/**
 * @author 明月工作室
 */
public class FlywayTest {

    public static void main(String[] args) {
        String url = "jdbc:mysql://192.168.8.38:3306/flyway?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&rewriteBatchedStatements=true&useSSL=false&serverTimezone=GMT%2B8";
        String user = "root";
        String password = "Jxkj@2021";
        Flyway flyway = Flyway.configure().dataSource(url, user, password).load();
        flyway.migrate();        // 创建 flyway_schema_history 表
//        flyway.baseline();
//        flyway.
//        flyway.baseline();
        // 删除 flyway_schema_history 表中失败的记录
//        flyway.repair();
        // 检查 sql 文件
//        flyway.validate();
        // 执行数据迁移
//        flyway.migrate();
        // 删除当前 schema 下所有表
        flyway.clean();
    }
}
